<template>
  <el-collapse-item title="样式" name="style">
    <el-form label-width="70px">
      <el-form-item label="字号">
        <el-input v-model="curComponent.fontSize" type="number"><template slot="append">px</template></el-input>
      </el-form-item>
      <el-form-item label="字体">
        <el-select v-model="curComponent.fontFamily">
          <el-option
            v-for="item in subtitleFontFamilyOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="文本显示">
        <el-radio-group v-model="curComponent.textShow">
          <el-radio label="0">单行</el-radio>
          <el-radio label="1">多行</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="对齐">
        <el-radio-group v-model="curComponent.textAlign" class="align-radio">
          <el-radio-button label="left">
            <svg-icon width="15" height="15" icon-class="align-left" />
          </el-radio-button>
          <el-radio-button label="center">
            <svg-icon width="15" height="15" icon-class="align-center" />
          </el-radio-button>
          <el-radio-button label="right"><svg-icon width="15" height="15" icon-class="align-right" /></el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="文本设置" class="form-text">
        <el-checkbox-group v-model="curComponent.fontStyle">
          <el-checkbox-button class="checkbox-style-btn" true-label="italic" false-label="">
            <svg-icon width="15" height="15" icon-class="italic" />
          </el-checkbox-button>
        </el-checkbox-group>
        <el-checkbox-group v-model="curComponent.fontWeight">
          <el-checkbox-button class="checkbox-style-btn" true-label="bold" false-label="">
            <svg-icon width="15" height="15" icon-class="bold" />
          </el-checkbox-button>
        </el-checkbox-group>
        <el-checkbox-group v-model="curComponent.textDecoration">
          <el-checkbox-button class="checkbox-style-btn" true-label="underline" false-label="">
            <svg-icon width="15" height="15" icon-class="underline" />
          </el-checkbox-button>
        </el-checkbox-group>
        <el-checkbox-group v-model="curComponent.textDecoration">
          <el-checkbox-button class="checkbox-style-btn" true-label="line-through" false-label=""
            ><svg-icon width="15" height="15" icon-class="line-through"
          /></el-checkbox-button>
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="字体颜色">
        <el-color-picker v-model="curComponent.fontColor" class="flex-item"></el-color-picker>
      </el-form-item>
      <el-form-item label="显示文字">
        <el-input v-model="curComponent.textGroup[0].text" type="textarea"></el-input>
      </el-form-item>
      <el-form-item label="背景颜色">
        <el-color-picker v-model="curComponent.background" class="flex-item"></el-color-picker>
      </el-form-item>
    </el-form>
  </el-collapse-item>
</template>

<script>
import { subtitleFontFamilyOptions } from '@/utils/attr'

export default {
  name: 'FontAttr',
  data() {
    this.subtitleFontFamilyOptions = subtitleFontFamilyOptions
    return {}
  },
  computed: {
    curComponent() {
      return this.$store.state.curComponent
    },
  },
}
</script>
<style scoped lang="scss">
.form-text {
  ::v-deep .el-form-item__content {
    display: flex !important;
    .el-checkbox-group {
      &:not(:last-child) {
        .el-checkbox-button:last-child .el-checkbox-button__inner {
          border-right: none;
          border-radius: 0;
        }
      }
      &:first-child {
        .el-checkbox-button:last-child .el-checkbox-button__inner {
          border-radius: 4px 0 0 4px;
        }
      }
    }
  }
}
</style>
